package com.wcl.demo.model.entity;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import de.greenrobot.dao.AbstractDaoMaster;
import de.greenrobot.dao.identityscope.IdentityScopeType;

import com.wcl.demo.model.entity.UserDao;
import com.wcl.demo.model.entity.Mp3InfoDao;
import com.wcl.demo.model.entity.UserInforDao;
import com.wcl.demo.model.entity.InviteMessagesDao;
import com.wcl.demo.model.entity.InviteMessageDao;
import com.wcl.demo.model.entity.AroundInforDao;
import com.wcl.demo.model.entity.BackGroundDataDao;
import com.wcl.demo.model.entity.NoteBgDataDao;
import com.wcl.demo.model.entity.CanSendDataDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * Master of DAO (schema version 1000): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 1000;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
        UserDao.createTable(db, ifNotExists);
        Mp3InfoDao.createTable(db, ifNotExists);
        UserInforDao.createTable(db, ifNotExists);
        InviteMessagesDao.createTable(db, ifNotExists);
        InviteMessageDao.createTable(db, ifNotExists);
        AroundInforDao.createTable(db, ifNotExists);
        BackGroundDataDao.createTable(db, ifNotExists);
        NoteBgDataDao.createTable(db, ifNotExists);
        CanSendDataDao.createTable(db, ifNotExists);
    }
    
    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(SQLiteDatabase db, boolean ifExists) {
        UserDao.dropTable(db, ifExists);
        Mp3InfoDao.dropTable(db, ifExists);
        UserInforDao.dropTable(db, ifExists);
        InviteMessagesDao.dropTable(db, ifExists);
        InviteMessageDao.dropTable(db, ifExists);
        AroundInforDao.dropTable(db, ifExists);
        BackGroundDataDao.dropTable(db, ifExists);
        NoteBgDataDao.dropTable(db, ifExists);
        CanSendDataDao.dropTable(db, ifExists);
    }
    
    public static abstract class OpenHelper extends SQLiteOpenHelper {

        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }
    
    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }
    }

    public DaoMaster(SQLiteDatabase db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(UserDao.class);
        registerDaoClass(Mp3InfoDao.class);
        registerDaoClass(UserInforDao.class);
        registerDaoClass(InviteMessagesDao.class);
        registerDaoClass(InviteMessageDao.class);
        registerDaoClass(AroundInforDao.class);
        registerDaoClass(BackGroundDataDao.class);
        registerDaoClass(NoteBgDataDao.class);
        registerDaoClass(CanSendDataDao.class);
    }
    
    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }
    
    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }
    
}
